<?php
/**
 * 共通メソッド処理をまとめたクラス<br />
 *
 * @package apamanshop
 * @author Y.Shibutani
 * @copyright
 */
class Apm_Campaign extends Apm_Model_Base
{
	public static function getAgentFlag($user_agent){

		$result = 3;

		//スマートフォン
		if(preg_match("/Android 2.3/",$user_agent))											{ $result = 2; }
		elseif (preg_match("/Android 2.2/",$user_agent))									{ $result = 2;  }
		elseif (preg_match("/Android 2.1/",$user_agent))									{ $result = 2;  }
		elseif (preg_match("/Android 1.6/",$user_agent))									{ $result = 2;  }
		elseif (preg_match("/Android 1.5/",$user_agent))									{ $result = 2;  }
		elseif (preg_match("/Android 1.1/",$user_agent))									{ $result = 2;  }
		elseif (preg_match("/Android 1.0/",$user_agent))									{ $result = 2;  }
		elseif (preg_match("/iPhone/",$user_agent))											{ $result = 2;  }

		//PC
		elseif(preg_match("/DreamPassport/",$user_agent))										{ $result = 1; }
		elseif (preg_match("/Win 9x 4.90/",$user_agent))									{ $result = 1;  }
		elseif (preg_match("/Windows 98/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/Win98/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Windows 95/",$user_agent))										{ $result = 1; }
		elseif (preg_match("/Win95/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Windows XP/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/Windows NT 5.1/",$user_agent))									{ $result = 1;  }
		elseif (preg_match("/Windows 2000/",$user_agent))									{ $result = 1;  }
		elseif (preg_match("/Windows NT 5/",$user_agent))									{ $result = 1;  }
		elseif (preg_match("/Windows NT/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/WinNT/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Windows CE/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/Borg/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Win32/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Windows/",$user_agent))										{ $result = 1;  }

		elseif (preg_match("/Mac OS X/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/Mac_PowerPC/",$user_agent))									{ $result = 1;  }
		elseif (preg_match("/Mac/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Macintosh/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/SunOS/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/FreeBSD/",$user_agent))										{ $result = 1;  }

		elseif (preg_match("/Kondara/",$user_agent))										{ $result = 1;  }
		elseif (preg_match("/Vine/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Debian/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Laser5/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/Linux/",$user_agent))											{ $result = 1;  }
		elseif (preg_match("/X11/",$user_agent))											{ $result = 1;  }

		return $result;
	}
}
?>
